<!DOCTYPE html>
<html>

<head>
  <title>Consuming a gRPC Service</title>
  <script id="adobe_dtm" src="https://www.redhat.com/dtm.js" type="text/javascript"></script>
  <script src="/assets/javascript/highlight.pack.js" type="text/javascript"></script>
  <META HTTP-EQUIV='Content-Security-Policy' CONTENT="default-src 'none'; script-src 'self' 'unsafe-eval' 'sha256-ANpuoVzuSex6VhqpYgsG25OHWVA1I+F6aGU04LoI+5s=' 'sha256-ipy9P/3rZZW06mTLAR0EnXvxSNcnfSDPLDuh3kzbB1w=' js.bizographics.com https://www.redhat.com assets.adobedtm.com jsonip.com https://ajax.googleapis.com https://www.googletagmanager.com https://www.google-analytics.com https://use.fontawesome.com; style-src 'self' https://fonts.googleapis.com https://use.fontawesome.com; img-src 'self' *; media-src 'self' ; frame-src https://www.googletagmanager.com https://www.youtube.com; frame-ancestors 'none'; base-uri 'none'; object-src 'none'; form-action 'none'; font-src 'self' https://use.fontawesome.com https://fonts.gstatic.com;">
  <META HTTP-EQUIV='X-Frame-Options' CONTENT="DENY">
  <META HTTP-EQUIV='X-XSS-Protection' CONTENT="1; mode=block">
  <META HTTP-EQUIV='X-Content-Type-Options' CONTENT="nosniff">
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="description" content="Quarkus: Supersonic Subatomic Java">
  <meta name="twitter:card" content="summary_large_image">
  <meta name="twitter:site" content="@QuarkusIO"> 
  <meta name="twitter:creator" content="@QuarkusIO">
  <meta property="og:url" content="https://quarkus.io/guides/grpc-service-consumption" />
  <meta property="og:title" content="Consuming a gRPC Service" />
  <meta property="og:description" content="Quarkus: Supersonic Subatomic Java" />
  <meta property="og:image" content="/assets/images/quarkus_card.png" />
  <link rel="canonical" href="https://quarkus.io/guides/grpc-service-consumption">
  <link rel="shortcut icon" type="image/png" href="/favicon.ico" >
  <link rel="stylesheet" href="https://quarkus.io/guides/stylesheet/config.css" />
  <link rel="stylesheet" href="/assets/css/main.css" />
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous">
  <link rel="alternate" type="application/rss+xml"  href="https://quarkus.io/feed.xml" title="Quarkus">
  <script src="https://quarkus.io/assets/javascript/goan.js" type="text/javascript"></script>
  <script src="https://quarkus.io/assets/javascript/hl.js" type="text/javascript"></script>
</head>

<body class="guides">
  <!-- Google Tag Manager (noscript) -->
  <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-NJWS5L"
  height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
  <!-- End Google Tag Manager (noscript) -->

  <div class="nav-wrapper">
  <div class="grid-wrapper">
    <div class="width-12-12">
      <input type="checkbox" id="checkbox" />
      <nav id="main-nav" class="main-nav">
  <div class="container">
    <div class="logo-wrapper">
      
        <a href="/"><img src="/assets/images/quarkus_logo_horizontal_rgb_600px_reverse.png" class="project-logo" title="Quarkus"></a>
      
    </div>
    <label class="nav-toggle" for="checkbox">
      <i class="fa fa-bars"></i>
    </label>
    <div id="menu" class="menu">
      <span>
        <a href="/get-started/" class="">Get Started</a>
      </span>
      <span>
        <a href="/guides/" class="active">Guides</a>
      </span>
      <span>
        <a href="/community/" class="">Community</a>
      </span>
      <span>
        <a href="/support/" class="">Support</a>
      </span>
      <span>
        <a href="/blog/" class="">Blog</a>
      </span>
      <span>
        <a href="https://code.quarkus.io" class="button-cta secondary white">Start Coding</a>
      </span>
    </div>
  </div>
      </nav>
    </div>
  </div>
</div>

  <div class="content">
    <div class="guide">
  <div class="width-12-12">
    <h1 class="text-caps">Consuming a gRPC Service</h1>
    <div class="hide-mobile toc"><ul class="sectlevel1">
<li><a href="#stubs-and-injection">Stubs and Injection</a></li>
<li><a href="#examples">Examples</a>
<ul class="sectlevel2">
<li><a href="#using-a-blocking-and-mutiny-stubs">Using a blocking and mutiny stubs</a></li>
<li><a href="#handling-streams">Handling streams</a></li>
</ul>
</li>
<li><a href="#client-configuration">Client configuration</a></li>
<li><a href="#example-of-configuration">Example of configuration</a>
<ul class="sectlevel2">
<li><a href="#enabling-tls">Enabling TLS</a></li>
<li><a href="#tls-with-mutual-auth">TLS with Mutual Auth</a></li>
</ul>
</li>
</ul></div>
    <div>
      <div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>gRPC services can be injected in your application code.</p>
</div>
<div class="admonitionblock important">
<table>
<tr>
<td class="icon">
<i class="fa icon-important" title="Important"></i>
</td>
<td class="content">
Consuming gRPC services requires the gRPC classes to be generated.
Place your <code>proto</code> files in <code>src/main/proto</code> and run <code>mvn compile</code>.
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="sect1">
<h2 id="stubs-and-injection"><a class="anchor" href="#stubs-and-injection"></a>Stubs and Injection</h2>
<div class="sectionbody">
<div class="paragraph">
<p>gRPC generation provides several stubs, providing different way to consume a service.
Quarkus gRPC can inject:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>blocking stubs</p>
</li>
<li>
<p>reactive stubs based on Mutiny</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>In addition, it also can inject the gRPC <code>io.grpc.Channel</code>, that lets you create other types of stubs.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="java" class="language-java hljs">@Inject @GrpcService("hello-service")
MutinyGreeterGrpc.MutinyGreeterStub mutiny;

@Inject @GrpcService("hello-service")
GreeterGrpc.GreeterBlockingStub blocking;

@Inject @GrpcService("hello-service")
Channel channel;</code></pre>
</div>
</div>
<div class="paragraph">
<p>The stub class names are computed from the service name.
For example, if you use <code>Greeter</code> as service name as in:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">service Greeter {
    rpc SayHello (HelloRequest) returns (HelloReply) {}
}</code></pre>
</div>
</div>
<div class="paragraph">
<p>The Mutiny stub name is: <code>MutinyGreeterGrpc.MutinyGreeterStub</code>
The blocking stub name is: <code>GreeterGrpc.GreeterBlockingStub</code></p>
</div>
<div class="paragraph">
<p>Client injection must be qualified using <code>@GrpcService</code>.
This annotation indicates the configuration prefix used to configure the service.
For example, if you set it to <code>hello-service</code>, configuring the host of the service is done using <code>hello-service.host</code>.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="using-a-blocking-and-mutiny-stubs"><a class="anchor" href="#using-a-blocking-and-mutiny-stubs"></a>Using a blocking and mutiny stubs</h3>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="java" class="language-java hljs">@Inject @GrpcService("hello") GreeterGrpc.GreeterBlockingStub blockingHelloService;
@Inject @GrpcService("hello") MutinyGreeterGrpc.MutinyGreeterStub mutinyHelloService;

@GET
@Path("/blocking/{name}")
public String helloBlocking(@PathParam("name") String name) {
    return blockingHelloService.sayHello(HelloRequest.newBuilder().setName(name).build()).getMessage();
}

@GET
@Path("/mutiny/{name}")
public Uni&lt;String&gt; helloMutiny(@PathParam("name") String name) {
    return mutinyHelloService.sayHello(HelloRequest.newBuilder().setName(name).build())
            .onItem().transform(HelloReply::getMessage);
}</code></pre>
</div>
</div>
<div class="paragraph">
<p>Note that in this example, the <code>quarkus.grpc.clients.hello.host</code> property must be set.</p>
</div>
</div>
<div class="sect2">
<h3 id="handling-streams"><a class="anchor" href="#handling-streams"></a>Handling streams</h3>
<div class="paragraph">
<p>gRPC allows sending and receiving streams:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">service Streaming {
    rpc Source(Empty) returns (stream Item) {} // Returns a stream
    rpc Sink(stream Item) returns (Empty) {}   // Reads a stream
    rpc Pipe(stream Item) returns (stream Item) {}  // Reads a streams and return a streams
}</code></pre>
</div>
</div>
<div class="paragraph">
<p>Using the Mutiny stub, you can interact with these as follows:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="java" class="language-java hljs">package io.quarkus.grpc.example.streaming;

import io.grpc.examples.streaming.Empty;
import io.grpc.examples.streaming.Item;
import io.grpc.examples.streaming.MutinyStreamingGrpc;
import io.quarkus.grpc.runtime.annotations.GrpcService;
import io.smallrye.mutiny.Multi;

import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("/streaming")
@Produces(MediaType.APPLICATION_JSON)
public class StreamingEndpoint {

    @Inject @GrpcService("streaming") MutinyStreamingGrpc.MutinyStreamingStub client;

    @GET
    public Multi&lt;String&gt; invokeSource() {
        // Retrieve a stream
        return client.source(Empty.newBuilder().build())
                .onItem().transform(Item::getValue);
    }

    @GET
    @Path("sink/{max}")
    public Uni&lt;Void&gt; invokeSink(@PathParam("max") int max) {
        // Send a stream and wait for completion
        Multi&lt;Item&gt; inputs = Multi.createFrom().range(0, max)
                .map(i -&gt; Integer.toString(i))
                .map(i -&gt; Item.newBuilder().setValue(i).build());
        return client.sink(inputs).onItem().ignore().andContinueWithNull();
    }

    @GET
    @Path("/{max}")
    public Multi&lt;String&gt; invokePipe(@PathParam("max") int max) {
        // Send a stream and retrieve a stream
        Multi&lt;Item&gt; inputs = Multi.createFrom().range(0, max)
                .map(i -&gt; Integer.toString(i))
                .map(i -&gt; Item.newBuilder().setValue(i).build());
        return client.pipe(inputs).onItem().transform(Item::getValue);
    }

}</code></pre>
</div>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="client-configuration"><a class="anchor" href="#client-configuration"></a>Client configuration</h2>
<div class="sectionbody">
<div class="paragraph">
<p>For each gRPC service you inject in your application, you can configure the following attributes:</p>
</div>
<div class="paragraph configuration-legend">
<p><span class="icon"><i class="fa fa-lock" title="Fixed at build time"></i></span> Configuration property fixed at build time - All other configuration properties are overridable at runtime</p>
</div>
<table class="tableblock frame-all grid-all stretch configuration-reference">
<colgroup>
<col style="width: 80%;">
<col style="width: 10%;">
<col style="width: 10%;">
</colgroup>
<tbody>
<tr>
<th class="tableblock halign-left valign-top"><p class="tableblock"><a id="quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients"></a><a href="#quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients">Configures the gRPC clients</a></p></th>
<th class="tableblock halign-left valign-middle"><p class="tableblock">Type</p></th>
<th class="tableblock halign-left valign-middle"><p class="tableblock">Default</p></th>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.port"></a><code><a href="#quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.port">quarkus.grpc.clients."service-name".port</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The gRPC service port.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">int</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>9000</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.host"></a><code><a href="#quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.host">quarkus.grpc.clients."service-name".host</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The host name / IP on which the service is exposed.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">required <span class="icon"><i class="fa fa-exclamation-circle" title="Configuration property is required"></i></span></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.ssl.certificate"></a><code><a href="#quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.ssl.certificate">quarkus.grpc.clients."service-name".ssl.certificate</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The file path to a server certificate or certificate chain in PEM format.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">path</p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.ssl.key"></a><code><a href="#quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.ssl.key">quarkus.grpc.clients."service-name".ssl.key</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The file path to the corresponding certificate private key file in PEM format.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">path</p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.ssl.trust-store"></a><code><a href="#quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.ssl.trust-store">quarkus.grpc.clients."service-name".ssl.trust-store</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>An optional trust store which holds the certificate information of the certificates to trust</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">path</p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.plain-text"></a><code><a href="#quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.plain-text">quarkus.grpc.clients."service-name".plain-text</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>Whether <code>plain-text</code> should be used instead of <code>TLS</code>. Enables by default, except it TLS/SSL is configured. In this case, <code>plain-text</code> is disabled.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.keep-alive-time"></a><code><a href="#quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.keep-alive-time">quarkus.grpc.clients."service-name".keep-alive-time</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The duration after which a keep alive ping is sent.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><a href="https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html">Duration</a>
  <a href="#duration-note-anchor" title="More information about the Duration format"><span class="icon"><i class="fa fa-question-circle"></i></span></a></p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.flow-control-window"></a><code><a href="#quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.flow-control-window">quarkus.grpc.clients."service-name".flow-control-window</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The flow control window in bytes. Default is 1MiB.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">int</p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.idle-timeout"></a><code><a href="#quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.idle-timeout">quarkus.grpc.clients."service-name".idle-timeout</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The duration without ongoing RPCs before going to idle mode.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><a href="https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html">Duration</a>
  <a href="#duration-note-anchor" title="More information about the Duration format"><span class="icon"><i class="fa fa-question-circle"></i></span></a></p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.keep-alive-timeout"></a><code><a href="#quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.keep-alive-timeout">quarkus.grpc.clients."service-name".keep-alive-timeout</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The amount of time the sender of of a keep alive ping waits for an acknowledgement.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><a href="https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html">Duration</a>
  <a href="#duration-note-anchor" title="More information about the Duration format"><span class="icon"><i class="fa fa-question-circle"></i></span></a></p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.keep-alive-without-calls"></a><code><a href="#quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.keep-alive-without-calls">quarkus.grpc.clients."service-name".keep-alive-without-calls</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>Whether keep-alive will be performed when there are no outstanding RPC on a connection.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>false</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.max-hedged-attempts"></a><code><a href="#quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.max-hedged-attempts">quarkus.grpc.clients."service-name".max-hedged-attempts</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The max number of hedged attempts.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">int</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>5</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.max-retry-attempts"></a><code><a href="#quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.max-retry-attempts">quarkus.grpc.clients."service-name".max-retry-attempts</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The max number of retry attempts. Retry must be explicitly enabled.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">int</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>5</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.max-trace-events"></a><code><a href="#quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.max-trace-events">quarkus.grpc.clients."service-name".max-trace-events</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The maximum number of channel trace events to keep in the tracer for each channel or sub-channel.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">int</p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.max-inbound-message-size"></a><code><a href="#quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.max-inbound-message-size">quarkus.grpc.clients."service-name".max-inbound-message-size</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The maximum message size allowed for a single gRPC frame (in bytes). Default is 4 MiB.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">int</p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.max-inbound-metadata-size"></a><code><a href="#quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.max-inbound-metadata-size">quarkus.grpc.clients."service-name".max-inbound-metadata-size</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The maximum size of metadata allowed to be received (in bytes). Default is 8192B.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">int</p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.negotiation-type"></a><code><a href="#quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.negotiation-type">quarkus.grpc.clients."service-name".negotiation-type</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The negotiation type for the HTTP/2 connection. Accepted values are: <code>TLS</code>, <code>PLAINTEXT_UPGRADE</code>, <code>PLAINTEXT</code></p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>TLS</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.override-authority"></a><code><a href="#quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.override-authority">quarkus.grpc.clients."service-name".override-authority</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>Overrides the authority used with TLS and HTTP virtual hosting.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.per-rpc-buffer-limit"></a><code><a href="#quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.per-rpc-buffer-limit">quarkus.grpc.clients."service-name".per-rpc-buffer-limit</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The per RPC buffer limit in bytes used for retry.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">long</p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.retry"></a><code><a href="#quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.retry">quarkus.grpc.clients."service-name".retry</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>Whether retry is enabled. Note that retry is disabled by default.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>false</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.retry-buffer-size"></a><code><a href="#quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.retry-buffer-size">quarkus.grpc.clients."service-name".retry-buffer-size</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The retry buffer size in bytes.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">long</p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.user-agent"></a><code><a href="#quarkus-grpc-config-group-config-grpc-client-configuration_quarkus.grpc.clients.-service-name-.user-agent">quarkus.grpc.clients."service-name".user-agent</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>Use a custom user-agent.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
</tbody>
</table>
<div id="duration-note-anchor" class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="title">About the Duration format</div>
<div class="paragraph">
<p>The format for durations uses the standard <code>java.time.Duration</code> format.
You can learn more about it in the <a href="https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html#parse-java.lang.CharSequence-">Duration#parse() javadoc</a>.</p>
</div>
<div class="paragraph">
<p>You can also provide duration values starting with a number.
In this case, if the value consists only of a number, the converter treats the value as seconds.
Otherwise, <code>PT</code> is implicitly prepended to the value to obtain a standard <code>java.time.Duration</code> format.</p>
</div>
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>The <code>service-name</code> is the name set in the <code>@GrpcService</code>.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="example-of-configuration"><a class="anchor" href="#example-of-configuration"></a>Example of configuration</h2>
<div class="sectionbody">
<div class="paragraph">
<p>The 2 following examples uses <em>hello</em> as service name.
Don&#8217;t forget to replace it with the name you used in in the <code>@GrpcService</code> annotation.</p>
</div>
<div class="sect2">
<h3 id="enabling-tls"><a class="anchor" href="#enabling-tls"></a>Enabling TLS</h3>
<div class="paragraph">
<p>To enable TLS, use the following configuration:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">quarkus.grpc.clients.hello.host=localhost
quarkus.grpc.clients.hello.ssl.trust-store=src/main/resources/tls/ca.pem</code></pre>
</div>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
When SSL/TLS is configured, <code>plain-text</code> is automatically disabled.
</td>
</tr>
</table>
</div>
</div>
<div class="sect2">
<h3 id="tls-with-mutual-auth"><a class="anchor" href="#tls-with-mutual-auth"></a>TLS with Mutual Auth</h3>
<div class="paragraph">
<p>To use TLS with mutual authentication, use the following configuration:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">quarkus.grpc.clients.hello.host=localhost
quarkus.grpc.clients.hello.plain-text=false
quarkus.grpc.clients.hello.ssl.certificate=src/main/resources/tls/client.pem
quarkus.grpc.clients.hello.ssl.key=src/main/resources/tls/client.key
quarkus.grpc.clients.hello.ssl.trust-store=src/main/resources/tls/ca.pem</code></pre>
</div>
</div>
</div>
</div>
</div>
    </div>
  </div>
</div>

  </div>

  <div class="content project-footer">
  <div class="footer-section">
    <div class="logo-wrapper">
      <a href="/"><img src="/assets/images/quarkus_logo_horizontal_rgb_reverse.svg" class="project-logo" title="Quarkus"></a>
    </div>
  </div>
  <div class="grid-wrapper">
    <p class="grid__item width-3-12">Quarkus is open. All dependencies of this project are available under the <a href='https://www.apache.org/licenses/LICENSE-2.0' target='_blank'>Apache Software License 2.0</a> or compatible license.<br /><br />This website was built with <a href='https://jekyllrb.com/' target='_blank'>Jekyll</a>, is hosted on <a href='https://pages.github.com/' target='_blank'>Github Pages</a> and is completely open source. If you want to make it better, <a href='https://github.com/quarkusio/quarkusio.github.io' target='_blank'>fork the website</a> and show us what you’ve got.</p>

    
      <div class="width-1-12 project-links">
        <span>Navigation</span>
        <ul class="footer-links width-1-12">
          
            <li><a href="/">Home</a></li>
          
            <li><a href="/guides">Guides</a></li>
          
            <li><a href="/community/#contributing">Contribute</a></li>
          
            <li><a href="/faq">FAQ</a></li>
          
            <li><a href="/get-started">Get Started</a></li>
          
        </ul>
      </div>
    
      <div class="width-1-12 project-links">
        <span>Contribute</span>
        <ul class="footer-links width-1-12">
          
            <li><a href="https://twitter.com/quarkusio">Follow us</a></li>
          
            <li><a href="https://github.com/quarkusio">GitHub</a></li>
          
            <li><a href="/security">Security&nbsp;policy</a></li>
          
        </ul>
      </div>
    
      <div class="width-1-12 project-links">
        <span>Get Help</span>
        <ul class="footer-links width-1-12">
          
            <li><a href="https://groups.google.com/forum/#!forum/quarkus-dev">Forums</a></li>
          
            <li><a href="https://quarkusio.zulipchat.com">Chatroom</a></li>
          
        </ul>
      </div>
    

    
      <div class="width-3-12 more-links">
        <span>Quarkus is made of community projects</span>
        <ul class="footer-links">
          
            <li><a href="https://vertx.io/" target="_blank">Eclipse Vert.x</a></li>
          
            <li><a href="https://microprofile.io" target="_blank">Eclipse MicroProfile</a></li>
          
            <li><a href="https://hibernate.org" target="_blank">Hibernate</a></li>
          
            <li><a href="https://netty.io" target="_blank">Netty</a></li>
          
            <li><a href="https://resteasy.github.io" target="_blank">RESTEasy</a></li>
          
            <li><a href="https://camel.apache.org" target="_blank">Apache Camel</a></li>
          
            <li><a href="https://code.quarkus.io/" target="_blank">And many more...</a></li>
          
        </ul>
      </div>
    
  </div>
</div>
  <div class="content redhat-footer">
  <div class="grid-wrapper">
    <span class="licence">
      <i class="fab fa-creative-commons"></i><i class="fab fa-creative-commons-by"></i> <a href="https://creativecommons.org/licenses/by/3.0/" target="_blank">CC by 3.0</a> | <a href="https://www.redhat.com/en/about/privacy-policy">Privacy Policy</a>
    </span>
    <span class="redhat">
      Sponsored by
    </span>
    <span class="redhat-logo">
      <a href="https://www.redhat.com/" target="_blank"><img src="/assets/images/redhat_reversed.svg"></a>
    </span>
  </div>
</div>


  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js" integrity="sha384-8gBf6Y4YYq7Jx97PIqmTwLPin4hxIzQw5aDmUg/DDhul9fFpbbLcLh3nTIIDJKhx" crossorigin="anonymous"></script>
  <script type="text/javascript" src="/assets/javascript/mobile-nav.js"></script>
  <script type="text/javascript" src="/assets/javascript/scroll-down.js"></script>
  <script src="/assets/javascript/satellite.js" type="text/javascript"></script>
  <script src="https://quarkus.io/guides/javascript/config.js" type="text/javascript"></script>
  <script src="/assets/javascript/search-filter.js" type="text/javascript"></script>
  <script src="/assets/javascript/back-to-top.js" type="text/javascript"></script>
</body>

</html>
